function PatchTestQ4Crack
clc
%close all
addpath('../');
addpath('../../');
%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% mesh
%%%%%%%%%%%%%%%%%%%%%%%%%%%%
a = 200;
b = 200;
nodes = [ 0 0;
    a 0;
    a b;
    0 b ];
connectivities = [ 1 2 3 4];
mesh = createMesh(nodes,connectivities);
%mesh.printMyself();
%plotMesh(mesh);

%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% conditions
%%%%%%%%%%%%%%%%%%%%%%%%%%%%
lambda = linspace(0,1,31);
du = 2*0.05;
constraint = [  1 0 0 0.0 0.0;
    2 0 0 du 0.0;
    3 0 1 du 0.0;
    4 0 1 0.0 0.0   ];
setConstraints(mesh,constraint);

%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% element declaration; custom section
%%%%%%%%%%%%%%%%%%%%%%%%%%%%
M = fem2.Model(mesh);
nf = mesh.countFaces();
E = 30e3;
nu = 0.2;
H = -45;
ft = 3;
t = 1;
C = C_plane_stress(E,nu);
for i=1:nf
    e = fem2.MatlabStructuralElement(mesh.getFace(i-1));
    M.addElement(e);
    %create struct to contain element state variables
    es = createElementContainer();
    es.thickness = t;
    es.H = H;
    es.ft = ft;
    es.constitutiveMatrix = C;
    es.Xi = [0 0]';
    elements(i) = es;
end

postProcessInfo.infoList = {'resistant force','crack opening Linder','check sigma1'};
postProcessInfo.infoParam = {[1 4],[],[]};

% while 1
[elements,output] = solving_strategy_static_2(elements,M,...
    lambda,50,1e-6,postProcessInfo);

figure
res_node_1(:,:) = -output.resistant_force(:,1,:);
delta = lambda*du/2;
plot(delta,res_node_1);
%
plotMeshWithCrack(M,elements,{'normal','conditions','positive domain'});
% plotDeformedMesh(mesh,1);

%     disp('do you want to continue the analysis? ');
%     conti = input('y(1)/n(0):');
%     if conti == 1
%         disp('Analysis will continue from last lambda. Please provide new lambda target:');
%         lambda_max = input('next lambda target = ');
%         last_lambda = lambda(size(lambda(:),1));
%         step = input('lambda step = ');
%         lambda = (last_lambda+step):step:lambda_max;
%     else
%         break;
%     end
% end
rmpath('../');
rmpath('../../');
end
